diff options
| author | Adam Soltys <[email protected]> | 2025-01-21 23:26:32 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-21 23:26:32 -0800 |
| commit | a70316e64bcc9bad7fb626056f9cc58d1858dff9 (patch) | |
| tree | a185e9ee5210d5a83be08cfa15cd6343e2188b3e /src/routes/(app)/[username]/(profile)/notes/new | |
| parent | dd86867462148daa88a3f3727434773d67dcab43 (diff) | |
| download | coinos-ui-a70316e64bcc9bad7fb626056f9cc58d1858dff9.tar.gz coinos-ui-a70316e64bcc9bad7fb626056f9cc58d1858dff9.zip | |
notes
Diffstat (limited to 'src/routes/(app)/[username]/(profile)/notes/new')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/notes/new/+page.svelte | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte b/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte new file mode 100644 index 00000000..8957034d --- /dev/null +++ b/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte @@ -0,0 +1,41 @@ +<script> + import { goto } from "$app/navigation"; + import { send, sign } from "$lib/nostr"; + import { t } from "$lib/translations"; + import { focus } from "$lib/utils"; + + let { data } = $props(); + let { user } = $derived(data); + let { pubkey } = $derived(user); + let content = $state(); + + let submit = async (e) => { + try { + e.preventDefault(); + + let event = { + kind: 1, + content, + created_at: Math.round(Date.now() / 1000), + tags: [], + }; + + event = await sign(event); + await send(event); + + goto(`/${user.username}/notes`); + } catch (e) { + console.log(e); + } + }; +</script> + +<div class="container px-4 max-w-xl mx-auto space-y-5"> + <form method="POST" class="space-y-2 text-xl" onsubmit={submit}> + <textarea use:focus bind:value={content} placeholder={$t("notes.contents")} + ></textarea> + <button type="submit" class="btn btn-accent"> + {$t("payments.submit")}</button + > + </form> +</div> |
